package com.itheima.test2;

import com.itheima.domain.Student;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;

public class Test03 {
    public static void main(String[] args) throws Exception {
        Student student1 = new Student("坤坤1", 26);
        Student student2 = new Student("坤坤2", 26);
        Student student3 = new Student("坤坤3", 26);
        ArrayList<Student> list = new ArrayList<>();
        list.add(student1);
        list.add(student2);
        list.add(student3);

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("day13\\students2.txt"));
        oos.writeObject(list);
        oos.close();

    }

}
